package com.ruoyi.project.system.presentation.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.presentation.mapper.DataPresentationMapper;
import com.ruoyi.project.system.presentation.domain.DataPresentation;
import com.ruoyi.project.system.presentation.service.IDataPresentationService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 数据展示Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-20
 */
@Service
public class DataPresentationServiceImpl implements IDataPresentationService 
{
    @Autowired
    private DataPresentationMapper dataPresentationMapper;

    @Override
    public List<DataPresentation> selectDataPresentationByYear() {
        return dataPresentationMapper.selectDataPresentationByYear();
    }

    @Override
    public List<DataPresentation> selectDataPresentationByMonth() {
        return dataPresentationMapper.selectDataPresentationByMonth();
    }

    @Override
    public List<DataPresentation> selectDataPresentationByWeek() {
        return dataPresentationMapper.selectDataPresentationByWeek();
    }

    @Override
    public List<DataPresentation> selectDataPresentationBySeason() {
        return dataPresentationMapper.selectDataPresentationBySeason();
    }

    @Override
    public List<DataPresentation> selectDataPresentationByYearMonthDay() {
        return dataPresentationMapper.selectDataPresentationByYearMonthDay();
    }





    @Override
    public List<DataPresentation> selectList(DataPresentation dataPresentation, Integer state,Integer classifyState) {
        return dataPresentationMapper.selectList(dataPresentation,state,classifyState);
    }

    /**
     * 根据设备id和用户名查询
     * @param equipmentId
     * @param userName
     * @return
     */
    @Override
    public DataPresentation selectDataPresentationByEquipmentIdAndUserName(Long equipmentId, String userName) {
        return dataPresentationMapper.selectDataPresentationByEquipmentIdAndUserName(equipmentId,userName);
    }




    /**
     * 根据时间范围查询
     * @param beginTime
     * @param endTime
     * @return
     */
    @Override
    public List<DataPresentation> selectDataPresentationByTimeHorizon(Long beginTime, Long endTime) {
        return dataPresentationMapper.selectDataPresentationByTimeHorizon(beginTime,endTime);
    }








    /**
     * 查询数据展示列表
     * 
     * @param dataPresentation 数据展示
     * @return 数据展示
     */
    public List<DataPresentation> selectDataPresentationList(DataPresentation dataPresentation,Integer state,Integer classifyState)
    {
        return dataPresentationMapper.selectDataPresentationList(dataPresentation, state, classifyState);
    }

    /**
     * 新增数据展示
     * 
     * @param dataPresentation 数据展示
     * @return 结果
     */
    @Override
    public int insertDataPresentation(DataPresentation dataPresentation)
    {
        dataPresentation.setCreateTime(DateUtils.getNowDate());
        return dataPresentationMapper.insertDataPresentation(dataPresentation);
    }

    /**
     * 修改数据展示
     * 
     * @param dataPresentation 数据展示
     * @return 结果
     */
    @Override
    public int updateDataPresentation(DataPresentation dataPresentation)
    {
        return dataPresentationMapper.updateDataPresentation(dataPresentation);
    }

    /**
     * 批量删除数据展示
     * 
     * @param ids 需要删除的数据展示主键
     * @return 结果
     */
    @Override
    public int deleteDataPresentationByIds(String ids)
    {
        return dataPresentationMapper.deleteDataPresentationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除数据展示信息
     * 
     * @param id 数据展示主键
     * @return 结果
     */
    @Override
    public int deleteDataPresentationById(Long id)
    {
        return dataPresentationMapper.deleteDataPresentationById(id);
    }
}
